package springIOC.IOC_XML.manager;

import springIOC.IOC_XML.uitl.ConnectionUtil;

import java.sql.SQLException;

public class TransactionManager {
    private ConnectionUtil util;

    public ConnectionUtil getUtil() {
        return util;
    }

    public void setUtil(ConnectionUtil util) {
        this.util = util;
    }

    public void commit(){
        try {
            util.getConnection().commit();
        }catch (SQLException e){
            e.printStackTrace();
        }
    }

    public void rollBack(){
        try {
            util.getConnection().rollback();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public void beginTransaction(){
        try {
            util.getConnection().setAutoCommit(false);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    public void release(){
//        util.release();
    }
}
